package org.todo.dao;

import java.util.List;
import org.todo.domain.Category;

/**
 * Interface of a DAO object to store and retrieve category data in the DB
 * @author Matthias Braunhofer
 */
public interface CategoryDao {

    /**
     * Fetches all categories for a certain user from the DB (including also publicly available ones)
     * @param username
     * @return
     */
    public List<Category> findCategoriesForUser(String username);

    /**
     * Saves a category into the DB
     * @param category
     */
    public void saveCategory(Category category);

    /**
     * Deletes a category and all its containing todo items from the DB
     * @param category
     */
    public void deleteCategory(Category category);

    /**
     * Fetches a category from the DB passing its id
     * @param categoryId
     * @return
     */
    public Category getCategory(int categoryId);


    /**
     * Makes sure that the public category is created in the DB after startup
     */
    public void createPublicCategory();
}
